package org.example.scoredata;

import org.example.ConnectDatabase;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Addscore extends ConnectDatabase{
    public Addscore(){}
    public int addData(Score score){
        int isOK = 1;
        new ConnectDatabase();
        try {
            String SQL = "insert into historyscore values (?,?,?)";
            PreparedStatement sta  = con.prepareStatement(SQL);
            sta.setInt(1, score.getNum());
            sta.setString(2, score.getS_ID());
            sta.setInt(3, score.getScore());
            isOK = sta.executeUpdate();
            con.close();
        }
        catch(SQLException e) {
            System.out.println("试百灵庙");
        }
        return isOK;
    }

}
